package com.lineage.server.timecontroller.server;

import com.lineage.server.thread.GeneralThreadPool;
import java.util.TimerTask;
import java.util.concurrent.ScheduledFuture;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ServerWarTimer extends TimerTask {
  private static final Log _log = LogFactory.getLog(ServerWarTimer.class);
  
  private ScheduledFuture<?> _timer;
  
  public void start() {
    int timeMillis = 1000;
    this._timer = GeneralThreadPool.get().scheduleAtFixedRate(this, 1000L, 1000L);
  }
  
  public void run() {
    try {
      ServerWarExecutor.get().checkWarTime();
    } catch (Exception e) {
      _log.error("城战计时时间轴异常重启", e);
      GeneralThreadPool.get().cancel(this._timer, false);
      ServerWarTimer warTimer = new ServerWarTimer();
      warTimer.start();
    } 
  }
}
